package com.example.questionanswersystem.repository;

import com.example.questionanswersystem.entity.Question;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface QuestionRepository extends JpaRepository<Question, Long> {

    @Query(value = "SELECT * FROM questions WHERE MATCH(question_text, answer_text) AGAINST (:keyword IN BOOLEAN MODE)", nativeQuery = true)
    List<Question> findByKeyword(@Param("keyword") String keyword);
} 